class Solution
{
public:
    bool sumOfNumberAndReverse(int num)
    {
        for (int i = 0; i <= num; ++i)
        {
            if (i + reverseInt(i) == num)
            {
                return true;
            }
        }
        return false;
    }

    int reverseInt(int n)
    {
        int result = 0;
        while (n)
        {
            result *= 10;
            result += n % 10;
            n /= 10;
        }
        return result;
    }
};